package app

import bean.LanguageSkillMatch
import common.TApp
import controller.LanguageSkillAnalysisController
import org.apache.spark.streaming.dstream.DStream
import handler.LanguageSkillDataHandler

object LanguageSkillRealTimeApp extends TApp {
  private val controller = new LanguageSkillAnalysisController()

  start(appName = "LanguageSkillRealTimeApp") {
    // 从Kafka获取编程语言数据流（使用新创建的handler）
    val languageDataStream: DStream[LanguageSkillMatch] = 
      LanguageSkillDataHandler.kafkaLanguageSkillDataHandler("language_analysis_group", "ITproject")

    // 调度分析
    controller.dispatch(languageDataStream)

    // 启动流处理
    LanguageSkillDataHandler.startAndAwait()
  }
}